{% extends "mongonaut/base.html" %}

{% load mongonaut_tags %}

{% block breadcrumbs %}
<li class="breadcrumb-item active"><a href='{% url "index" %}'>Mongonaut</a></li>
{% endblock %}

{% block content %}

<h1>Mongonaut</h1>

<div class="row">
    <div class="span12">
{% for app in object_list %}

    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                <th colspan=3>{{ app.app_name.title }}</th>
            </tr>
        </thead>
        
        <tbody>
        {% for model in app.obj.models %}
            <tr>
                <td><a href="{% url "document_list" app.app_name model.name %}">{{ model.name }}</a></td>
                {% if request.user.is_admin or request.user.is_staff %}
                    <td><a href="{% url "document_detail_add_form" app.app_name model.name %}">Add</a></td>
                    <td><a href="{% url "document_list" app.app_name model.name %}">Change</a></td>                        
                {% else %}
                    <td>Add</td>
                    <td>Change</td>
                {% endif %}    
            </tr>
        {% endfor %}
        </tbody>        
    </table>    
{% endfor %}
    </div>
</div>    

{% endblock %}
